package com.htudata.history.dao;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.util.List;

import com.htudata.history.mapper.HistoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class HistoryDao {
  @Autowired
  private HistoryMapper historyMapper;
  
  public JSONArray selectHistoryAndChangeByItemId(List<Object> itemList, String tableName) {
    JSONObject params = new JSONObject();
    params.put("itemList", itemList);
    params.put("tableName", tableName);
    return this.historyMapper.selectHistoryAndChangeByItemId(params);
  }
  
  public JSONArray selectHisAndChangeByItemId(List<Object> itemList, String tableName, int needChangeValue, long startTime) {
    JSONObject params = new JSONObject();
    params.put("itemList", itemList);
    params.put("tableName", tableName);
    params.put("needChangeValue", Integer.valueOf(needChangeValue));
    params.put("startTime", Long.valueOf(startTime));
    return this.historyMapper.selectHisAndChangeByItemId(params);
  }
  
  public JSONArray selectHistoryByItemId(List<Object> itemList, String tableName) {
    JSONObject params = new JSONObject();
    params.put("itemList", itemList);
    params.put("tableName", tableName);
    return this.historyMapper.selectHistoryByItemId(params);
  }
  
  public JSONArray selectHisByItemId(List<Object> itemList, String tableName) {
    JSONObject params = new JSONObject();
    params.put("itemList", itemList);
    params.put("tableName", tableName);
    return this.historyMapper.selectHisByItemId(params);
  }
}
